<?php
namespace app\index\controller;

use think\Controller;
use think\Db;
use think\facade\Cookie;
use think\facade\View;

class Common extends Controller
{

    protected function initialize()
    {
        $link = Db::name('link')->where('enabled', 1)->where('channel', 3)->where('is_trash', 0)->order('sort desc, id desc')->select();
        View::share('link', $link);
        View::share('showLink', 0);


        // 设置用户身份标识
        if(!Cookie::has('visitor_id')){
            Cookie::forever('visitor_id', getGuidV4());
        }
    }

}
